package com.fr.report.core.barcode.pdf417;

import com.fr.base.core.GraphHelper;
import com.fr.report.core.barcode.BarcodeException;
import com.fr.report.core.barcode.BarcodeImpl;
import com.fr.report.core.barcode.BlankModule;
import com.fr.report.core.barcode.Module;
import com.fr.report.core.barcode.output.GraphicsOutput;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

public class PDF417Barcode extends BarcodeImpl
{
  private PDF417Module module;

  public PDF417Barcode(String paramString)
    throws BarcodeException
  {
    super(paramString);
    this.barWidth = 1.0D;
    this.drawingText = false;
  }

  public void setDrawingText(boolean paramBoolean)
  {
  }

  public void setBarWidth(double paramDouble)
  {
  }

  public void setBarHeight(double paramDouble)
  {
  }

  public void setResolution(int paramInt)
  {
  }

  protected double getBarcodeWidth(int paramInt)
  {
    initBarcode(this.data);
    return this.module.getBarcodeWidth();
  }

  protected double calculateMinimumBarHeight(int paramInt)
  {
    initBarcode(this.data);
    return this.module.getBarcodeHeight();
  }

  protected Module[] encodeData()
  {
    initBarcode(this.data);
    return new Module[] { new PDF417Module(this.data) };
  }

  protected Module calculateChecksum()
  {
    return new BlankModule(0);
  }

  protected Module getPreAmble()
  {
    return new BlankModule(0);
  }

  protected Module getPostAmble()
  {
    return new BlankModule(0);
  }

  private void initBarcode(String paramString)
  {
    if (this.module == null)
    {
      this.module = new PDF417Module(paramString);
      GraphicsOutput localGraphicsOutput = new GraphicsOutput((Graphics2D)GraphHelper.createBufferedImage(1000, 1000, 10).getGraphics(), null, this.barWidth, this.barHeight, false, Color.black, Color.white);
      this.module.draw(localGraphicsOutput, 0.0D, 0.0D);
    }
  }
}